# -*- coding : utf-8 -*-
# @Time    : 2023/6/7 10:44
# @Author  : wanggang
# @Email   : wanggang2@lingxi.ai
# @File    : settings.py
# @Software: LLM_server_v2.0

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import os
from datetime import datetime

from dialogue.util import logger

CREDIT_PORT = 18635
CREDIT_PROCESSING_NUM = 1
BREAK_PORT = 18630
BREAK_PROCESSING_NUM = 1

ROOT_PATH = os.path.dirname(os.path.realpath(__file__))
log_path = "{}/".format(ROOT_PATH)
now = datetime.now()
current_time = now.strftime("%Y-%m-%d")
if not os.path.exists(log_path):
    os.makedirs(log_path)
log = logger.Logger(os.path.join(log_path, 'dialogue.log'), level='info').logger
# 话术文档
# dialogue_file_path = "{}/LLM/{}".format(ROOT_PATH, "[UJD-2call-0705-LLM].xlsx")
# dialogue_file_path = "{}/LLM/{}".format(ROOT_PATH, "[360-UJD-首贷].xlsx")
# dialogue_file_sheet = "Sheet1"
# dialogue_file_path = "{}/dialogue/excel/{}".format(ROOT_PATH, "京东白条—京东金融批次.xlsx")
# dialogue_file_sheet = "白条金融0830"
dialogue_file_path = "{}/dialogue/excel/{}".format(ROOT_PATH, "中科加微话术流程.xlsx")
dialogue_file_sheet = "中科加微初版-0828"

# 知识库向量文件服务器地址
KNOWLEDGE_EMBEDDINGS_DATA_SERVER_IP = 'socket.chatlingxi.com'
KNOWLEDGE_EMBEDDINGS_DATA_SERVER = 'http://{}:8899/insurance_planner_gpt'.format(KNOWLEDGE_EMBEDDINGS_DATA_SERVER_IP)
KNOWLEDGE_EMBEDDINGS_DATA_PATH = '/home/admin/app/knowledge_embedding_base/insurance_planner_gpt/'


# DM数据库
ONLINE = True
TEST = 'D'
DM_DATABASE_HOST = "47.92.193.147"
if ONLINE:
    DM_DATABASE_HOST = "47.92.193.147"
    # DM_DATABASE_HOST = "172.26.172.65"
DM_DATABASE_USERNAME = "root"
DM_DATABASE_PASSWORD = "Moxi123#"
DM_DATABASE_SCHEMA = "task_dialogue_config"

# DM_REDIS
DM_REDIS_HOST = 'redis-6rnwcu6pe1ze-proxy-redis-6rnwcu6pe1ze-hb.jvessel2.jdcloud.com'
if ONLINE:
    DM_REDIS_HOST = 'redis-6rnwcu6pe1ze-proxy-nlb.jvessel-open-hb.jdcloud.com'
DM_REDIS_PORT = 6379
DM_REDIS_PASSWORD = 'Lingxird2024'
DM_REDIS_DB = 1
if ONLINE:
    DM_REDIS_DB = 0

# rabbitmq
MQ_CONFIG = {
    "hostname": "amqp-cn-7pp24sn1z001.mq-amqp.cn-zhangjiakou-2914449-a.aliyuncs.com",
    "username": "MjphbXFwLWNuLTdwcDI0c24xejAwMTpMVEFJR2JEb0o4a1J4ZHJl",
    "password": "MUVDRjRERTQwN0I4NzBCQ0Q2NjEzQzhGMzc3NDlBOEI0NTQ2RUI5RDoxNjE4NTQwODIyMjc4",
    "port": 5672,
    "vhost": "data_center",  # 虚拟主机，VirtualHost之间相互隔离
    "exchange": "dm_record",  # 交换机
    "queue": "dm_record",  # 队列
    "routing_key": "dm_record",  # 交换机和队列的绑定

}
# 接口地址
PLATFORM_CASE_INFO_URL = "https://work.xi-ai.com/strategy/ai/findCaseInfoBySessionId?sessionId="
if ONLINE:
    PLATFORM_CASE_INFO_URL = "http://172.26.5.62:15331/strategy/ai/findCaseInfoBySessionId?sessionId="

# 评分卡
TRANSFER_URL = "http://39.101.178.204:8960/judgeTransfer"
if ONLINE:
    TRANSFER_URL = "http://172.26.5.45:18960/judgeTransfer"

# # 请求对话流程
# DIALOGUE_URL = "http://8.142.25.111:18631/dialogue"
# if ONLINE:
#     DIALOGUE_URL = "http://172.26.2.48:18631/dialogue"
# #
# 请求对话流程
DIALOGUE_URL = "http://8.142.85.77:8630/dialogue"
if ONLINE:
    DIALOGUE_URL = "http://172.26.2.56:8630/dialogue"

# # 请求对话流程LLM
# DIALOGUE_URL = "http://39.99.244.42:18635/dialogue"
# if ONLINE:
#     DIALOGUE_URL = "http://39.99.244.42:18635/dialogue"

# 信贷打标服务
CREDIT_NLU_URL = 'http://101.126.41.130:7173/nlu_llm?dialogue={}&tag={}'
if ONLINE:
    CREDIT_NLU_URL = 'http://192.168.1.10:7173/nlu_llm?dialogue={}&tag={}'
if TEST == 'A':
    CREDIT_NLU_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230629175442-8wl5m/proxy/7173/nlu_llm?dialogue={}&tag={}',  # A
elif TEST == 'B':
    CREDIT_NLU_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230403143403-mfqlm/proxy/7173/nlu_llm?dialogue={}&tag={}',  # B
elif TEST == 'C':
    CREDIT_NLU_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230330215341-pwcgr/proxy/7173/nlu_llm?dialogue={}&tag={}',  # C
elif TEST == 'D':
    CREDIT_NLU_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230322173305-2swjc/proxy/7173/nlu_llm?dialogue={}&tag={}',  # D

# 信贷话术选择服务
CREDIT_DIALOGUE_URL = 'http://101.126.41.130:8200/credit_v2'
if ONLINE:
    CREDIT_DIALOGUE_URL = 'http://192.168.1.10:8200/credit_v2'

# 整体打断服务
BREAK_URL = 'http://8.142.85.77:8678/predict?type={}&sessionId={}&query={}'
if ONLINE:
    BREAK_URL = 'http://172.26.2.56:8678/predict?type={}&sessionId={}&query={}'

if TEST == 'A':
    CREDIT_DIALOGUE_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230629175442-8wl5m/proxy/8200/credit_v2',  # A
elif TEST == 'B':
    CREDIT_DIALOGUE_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230403143403-mfqlm/proxy/8200/credit_v2',  # B
elif TEST == 'C':
    CREDIT_DIALOGUE_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230330215341-pwcgr/proxy/8200/credit_v2',  # C
elif TEST == 'D':
    CREDIT_DIALOGUE_URL = 'https://ccb8is4fqtofrtdsfjebg.ml-platform-cn-beijing.volces.com/devinstance/di-20230322173305-2swjc/proxy/8200/credit_v2',  # D

COOKIE = 'code-server-session=c24fac1095b7e4096578e9e0c4a49cdf3ade8d26209c8c7b12737b7aa0f6678b'
# 开发机A100cookie
if TEST == 'A':
    COOKIE = 'code-server-session=c24fac1095b7e4096578e9e0c4a49cdf3ade8d26209c8c7b12737b7aa0f6678b',  # A
elif TEST == 'B':
    COOKIE = 'code-server-session=187399ef3c11da6f59a44ddd0adb5a69014173286b11e3a621002dc0a0e7020d',  # B
elif TEST == 'C':
    COOKIE = 'code-server-session=acebb54604bd46481044eff6d888e5cc7b715d1eed5c5896edbf6b7408a5fdee',  # C
elif TEST == 'D':
    COOKIE = 'code-server-session=6ed9af325f2b7ec3c8a1d02651d816cdc5390e3192298a2ba25d02f1b9fcdac6',  # D

FAMILY_NAME = {
    'credit': '户扈么闷呢你却雀确啊哎埃凹摆采彩仓苍草曾柴昌池迟茌揣歹的狄迪敌翟迭牒娥俄讹额恩盖还好郝蒋卡佧懒朗勒区上若洒睢他它她谈谭潭檀央仰耶冶野乙以蚁倚逊雅演金是何余安沈闫廖齐黎杨孔唐洪易薛代贾付肖苏潘冯丁庄季施欧严段石韩朱颜阮熊祝关范姜郭林倪尹甘贺许韦柳葛乔罗兰章万任武汪夏张庞邹殷俞蔡于吴杜雷江顾莫左覃骆梁曹卢申秦陶高陆吕钟郑宋田毛康袁周叶耿戴孙龚钱陈王胡邱鲁宁方聂龙姚邢焦梅刘赵牛徐詹伍邓赖孟侯程汤白樊华向黄盛文魏李游岳柯马董翁傅崔谢史温彭邵常解',
    'insurance': '户扈么闷呢你却雀确啊哎埃凹摆采彩仓苍草曾柴昌池迟茌揣歹的狄迪敌翟迭牒娥俄讹额恩盖还好郝蒋卡佧懒朗勒区上若洒睢他它她谈谭潭檀央仰耶冶野乙以蚁倚逊雅演金是何余安沈闫廖齐黎杨孔唐洪易薛代贾付肖苏潘冯丁庄季施欧严段石韩朱颜阮熊祝关范姜郭林倪尹甘贺许韦柳葛乔罗兰章万任武汪夏张庞邹殷俞蔡于吴杜雷江顾莫左覃骆梁曹卢申秦陶高陆吕钟郑宋田毛康袁周叶耿戴孙龚钱陈王胡邱鲁宁方聂龙姚邢焦梅刘赵牛徐詹伍邓赖孟侯程汤白樊华向黄盛文魏李游岳柯马董翁傅崔谢史温彭邵常解',
}

kafka_setting = {
    'sasl_plain_username': 'alikafka_pre-cn-7pp2x0xv1001',
    'sasl_plain_password': '2TKahc4owYx91omdFcVtYPeh9nUxafD5',
    'bootstrap_servers': ["alikafka-pre-cn-7pp2x0xv1001-1.alikafka.aliyuncs.com:9093","alikafka-pre-cn-7pp2x0xv1001-2.alikafka.aliyuncs.com:9093","alikafka-pre-cn-7pp2x0xv1001-3.alikafka.aliyuncs.com:9093"],
    'topic_name': 'dm_record',
    'group_name': 'dm_record',
    'consumer_id': '23'
}
